"use strict";
const fs = require('fs');
const path = require('path');
const readFile = path.join(__dirname,'readstream.flv');
const writeFile = path.join(__dirname, 'writestream.flv');
//创建一个文件读取流
let readStream = fs.createReadStream(readFile);
//创建一个文件写入流
let writeStream = fs.createWriteStream(writeFile);
console.log(writeStream);
//读取流的data事件不断被触发
readStream.on('data',(chunk)=>{
    writeStream.write(chunk);
});
readStream.on('end',(chunk)=>{
    console.log('读取完毕');
});